﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using road2.Views;
using road2.Model;

namespace road2.code
{
    public static class RoadUCCollectionExtensions
    {
        public static RoadUserControl RoadUCbyRoad(this IEnumerable<RoadUserControl> roadUCCollection, RoadClass road)
        {
            var tmpRUCs = roadUCCollection.Where(ruc => ruc.DataContext == road);

            if (tmpRUCs.Count() != 0)
            {
                return tmpRUCs.First();
            }

            return null;
        }
    }
}
